<?php
/**
 * 
 *
 * @category   Application_Extensions
 * @package    Recorder
 * @copyright  Copyright 2006-2010 Idragonsolution Developments
 * @license    http://idragonsolution.com/
 * @version    $Id: Bootstrap.php 9747 2012-07-26 02:08:08Z Thien $
 * @author     Thien
 */
class Recorder_Model_Recorder extends Core_Model_Item_Abstract
{
    public function getRichContent($view = false, $params = array())
    {
        $videoEmbedded = '';
    
        // $view == false means that this rich content is requested from the activity feed
        if( $view == false ){
          //$desc   = strip_tags($playlist->description);
         // $desc   = "<div class='music_desc'>".(Engine_String::strlen($desc) > 255 ? Engine_String::substr($desc, 0, 255) . '...' : $desc)."</div>";
          $zview  = Zend_Registry::get('Zend_View');
          $zview->playlist     = null;
          $zview->recorders        = array($this);
          $zview->short_player = true;
          $videoEmbedded       = $desc . $zview->render('application/modules/Recorder/views/scripts/_Player.tpl');
        }
    
        return $videoEmbedded;
    }
    
    public function getFilePath(){
        return $this->recorder_url;
    }
    
     /**
   * Gets a proxy object for the comment handler
   *
   * @return Engine_ProxyObject
   **/
  public function comments()
  {
    return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('comments', 'core'));
  }

  /**
   * Gets a proxy object for the like handler
   *
   * @return Engine_ProxyObject
   **/
  public function likes()
  {
    return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('likes', 'core'));
  }

  /**
   * Gets a proxy object for the tags handler
   *
   * @return Engine_ProxyObject
   **/
  public function tags()
  {
    return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('tags', 'core'));
  }
  
  public function getCommentCount()
  {
    return $this->comments()->getCommentCount();
  }
  
  public function getHref($params = array())
    {
        $params = array_merge(array(
          'route' => 'recorder_view',
          'reset' => true,
          'user_id' => $this->owner_id,
          'recorder_id' => $this->recorder_id,
          'slug' => $this->getSlug(),
        ), $params);
        $route = $params['route'];
        $reset = $params['reset'];
        unset($params['route']);
        unset($params['reset']);
        return Zend_Controller_Front::getInstance()->getRouter()
          ->assemble($params, $route, $reset);
   }

}